﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class PicEdit : System.Web.UI.Page
{
    public string Content = "";
    protected void Page_Load(object sender, EventArgs e)
    {
		if (Session["UserID"]==null)
		{
			Response.Write("<script>alert('你没有管理员权限，禁止访问！');history.back();</script>");
		}
		
		if (!Page.IsPostBack)
        {

            DataTable dt = Socut.Data.ExecuteDataSet("select * from web_indexpic where id=1").Tables[0];
				if (dt.Rows.Count==1)
				{
					strurl1.Text = dt.Rows[0]["strurl1"].ToString();
					Pic1.Text = dt.Rows[0]["picurl1"].ToString();
					strurl2.Text = dt.Rows[0]["strurl2"].ToString();
					Pic2.Text = dt.Rows[0]["picurl2"].ToString();
					strurl3.Text = dt.Rows[0]["strurl3"].ToString();
					Pic3.Text = dt.Rows[0]["picurl3"].ToString();
					strurl4.Text = dt.Rows[0]["strurl4"].ToString();
					Pic4.Text = dt.Rows[0]["picurl4"].ToString();
					addtime.Text = Convert.ToDateTime(dt.Rows[0]["addtime"]).ToString("yyyy-MM-dd");
			   }
			   else
			   {
			     	
			   }
			
        }
    }
	
	
    protected void Button1_Click(object sender, EventArgs e)
    {
        //Response.Write(strurl1.Text);
		//Response.End();
		string Msg, Url;
            Socut.Data.ExecuteNonQuery("update web_indexpic set strurl1='" + strurl1.Text + "',picurl1='" + Pic1.Text + "',strurl2='" + strurl2.Text + "',picurl2='" + Pic2.Text + "',strurl3='" + strurl3.Text + "',picurl3='" + Pic3.Text + "',strurl4='" + strurl4.Text + "',picurl4='" + Pic4.Text + "',addtime='" + addtime.Text + "' where id=1");
            Msg = "修改成功！";
            Url = "picedit.aspx";

        CommonFunction.ShowMessage(Msg,Url);
    }
	

}
